<!--
 * @description: 
 * @Author: Islands
 * @Date: 2024-06-14 15:26:53
 * @LastEditTime: 2024-06-24 00:01:39
-->
<script setup lang="ts">
import { storeToRefs } from 'pinia';
import { configStore } from '@/plugins/pinia/index';
import useInit from '@/hooks/init/index';
import { getCurrentInstance } from 'vue';
const { Widgets } = storeToRefs(configStore());
const { local } = useInit();

const internalInstance = getCurrentInstance();
const component = (path: any, Component: any, _route: any) => {
    if (path == '/login' || path == '/') {
        return Component;
    }
    return internalInstance?.appContext.components[Widgets.value.layout];
};

//初始化
useInit().init();
</script>
<template>
    <el-config-provider :locale="local" namespace="ep">
        <router-view #default="{ route, Component }">
            <transition :enter-active-class="`animate__animated ` + Widgets.anime[0]" appear>
                <keep-alive>
                    <el-scrollbar height="800px">
                        <component :is="component(route.fullPath, Component, route)" />
                    </el-scrollbar>
                </keep-alive>
            </transition>
        </router-view>
    </el-config-provider>
</template>
